<?php
namespace Guider\Model;
use Think\Model;

class CustomizedGuiderModel extends Model {
	protected $_auto = [
		["start_time", "strtotime", 3, "function"],
		["end_time", "strtotime", 3, "function"],
		["create_time", "time", 1, "function"],
		["update_time", "time", 2, "function"],
	];
	protected $_validate = [
		["id", "require", "ID必须填写!"],
		["user_id", "require", "购买用户必须填写!"],
		["guider_user_id", "require", "导游必须填写!"],
		["name", "require", "订单名称必须填写!"],
		["start_time", "require", "开始日期必须填写!"],
		["end_time", "require", "结束日期必须填写!"],
		["price", "require", "价格必须填写!"],
		["amount", "require", "总价必须填写!"],
		["user_name", "require", "用户姓名必须填写!"],
		["user_phone", "require", "用户电话必须填写!"],
		["user_gender", "require", "用户性别必须填写!"],
		["user_contract", "require", "用户补充合同必须填写!"],
		["guider_contract", "require", "导游补充合同必须填写!"],
		["content", "require", "行程详情必须填写!"],
		["state", "require", "订单状态必须填写!"],
		["user_contract_state", "require", "游客合同签署情况必须填写!"],
		["guider_contract_state", "require", "导游合同签署情况必须填写!"],
		["create_time", "require", "创建时间必须填写!"],
		["update_time", "require", "更新时间必须填写!"],
	];
	public $excel = false;
	public $delete = false;
	public $fieldMap = [
		"id" => [
			"type" => "input",
			"name" => "ID",
			"show" => true,
			"search" => true,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"user_id" => [
			"type" => "foreign",
			"name" => "购买用户",
			"show" => true,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "user,id,name,search",
			"list_specify" => "",
		],
		"guider_user_id" => [
			"type" => "input",
			"name" => "导游",
			"show" => false,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => false,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"name" => [
			"type" => "input",
			"name" => "订单名称",
			"show" => true,
			"search" => true,
			"input" => 'create',
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"start_time" => [
			"type" => "date",
			"name" => "开始日期",
			"show" => true,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"end_time" => [
			"type" => "date",
			"name" => "结束日期",
			"show" => true,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"price" => [
			"type" => "input",
			"name" => "价格",
			"show" => false,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"amount" => [
			"type" => "input",
			"name" => "总价",
			"show" => false,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"user_name" => [
			"type" => "input",
			"name" => "用户姓名",
			"show" => true,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"user_phone" => [
			"type" => "input",
			"name" => "用户电话",
			"show" => false,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => false,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"user_gender" => [
			"type" => "input",
			"name" => "用户性别",
			"show" => true,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"user_contract" => [
			"type" => "ueditor",
			"name" => "用户补充合同",
			"show" => false,
			"search" => false,
			"input" => 'create',
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
			"update_specify" => '
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="user_contract"> 用户补充合同 </label>
                <div class="col-xs-12 col-sm-6">
	                <div class="panel panel-default">
					  <div class="panel-body">
	                    	{$model["user_contract"]|html_entity_decode}
					  </div>
					</div>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
            </div>',
		],
		"guider_contract" => [
			"type" => "ueditor",
			"name" => "导游补充合同",
			"show" => false,
			"search" => false,
			"input" => true,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
			"update_specify" => '
			<if condition="($model[\'guider_contract_state\'] eq \'已签署\') AND ($model[\'user_contract_state\'] eq \'已签署\')">
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="guider_contract"> 导游补充合同 </label>
                <div class="col-xs-12 col-sm-6">
	                <div class="panel panel-default">
					  <div class="panel-body">
	                    	{$model["guider_contract"]|html_entity_decode}
					  </div>
					</div>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
            </div>
			<else/>
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="guider_contract"> 导游补充合同 </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <textarea class="col-xs-12 col-sm-6 width-100" style="padding: 5px 4px;" rows="5" id="guider_contract" name="guider_contract" placeholder="导游补充合同" validate-required="required:请填写导游补充合同" >{$model["guider_contract"]|default=\'\'}</textarea>
                        <i class=""></i>
                    </span>
                </div>
                <script type="text/javascript">var editor = UE.getEditor(\'guider_contract\');</script>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>
            </if>',
		],
		"content" => [
			"type" => "ueditor",
			"name" => "行程详情",
			"show" => false,
			"search" => false,
			"input" => true,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
			"update_specify" => '
			<if condition="($model[\'guider_contract_state\'] eq \'已签署\') AND ($model[\'user_contract_state\'] eq \'已签署\')">
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="guider_contract"> 行程详情 </label>
                <div class="col-xs-12 col-sm-6">
	                <div class="panel panel-default">
					  <div class="panel-body">
	                    	{$model["content"]|html_entity_decode}
					  </div>
					</div>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
            </div>
			<else/>
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="content"> 行程详情 </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <textarea class="col-xs-12 col-sm-6 width-100" style="padding: 5px 4px;" rows="5" id="content" name="content" placeholder="行程详情" validate-required="required:请填写行程详情" >{$model["content"]|default=\'\'}</textarea>
                        <i class=""></i>
                    </span>
                </div>
                <script type="text/javascript">var editor = UE.getEditor(\'content\');</script>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>
            </if>',
		],
		"state" => [
			"type" => "input",
			"name" => "订单状态",
			"show" => true,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"user_contract_state" => [
			"type" => "select",
			"name" => "游客合同签署情况",
			"show" => true,
			"search" => false,
			"input" => 'create',
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "未签署,已签署",
			"list_specify" => "",
		],
		"guider_contract_state" => [
			"type" => "select",
			"name" => "导游合同签署情况",
			"show" => true,
			"search" => false,
			"input" => 'create',
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "未签署,已签署",
			"list_specify" => "",
			"update_specify" => '
			<if condition="$model[\'guider_contract_state\'] eq \'已签署\'">
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="guider_contract_state"> 导游合同签署情况 </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <input type="text" class="width-100" id="guider_contract_state" name="guider_contract_state"  value="{$model[\'guider_contract_state\']|default=\'\'}" <if condition="ACTION_NAME eq update">readonly</if>/>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>
			<else/>
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="guider_contract_state"> 导游合同签署情况 </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <select name="guider_contract_state" id="guider_contract_state" class="width-100" <if condition="ACTION_NAME eq update">readonly</if>>
                             <option value="未签署" <if condition ="$model[\'guider_contract_state\'] eq \'未签署\'"> selected </if> >未签署</option>
                             <option value="已签署" <if condition ="$model[\'guider_contract_state\'] eq \'已签署\'"> selected </if> >已签署</option>
                        </select>
                        <i class=""></i>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>
			</if>',
		],
		"create_time" => [
			"type" => "datetime",
			"name" => "创建时间",
			"show" => false,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
		"update_time" => [
			"type" => "datetime",
			"name" => "更新时间",
			"show" => false,
			"search" => false,
			"input" => false,
			"required" => true,
			"detail" => true,
			"excel" => true,
			"content" => "",
			"list_specify" => "",
		],
        "insurance"=>[
            "type"=>"input",
            "name"=>"保险",
            "list"=>true,
            "search"=>false,
            "input"=>false,
            "required"=>false,
            "detail"=>false,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>'<td class="center"><a href="__MODULE__/InsuranceOrder/list?searchMap[order_type]=customized_guider&searchMap[order_id]={$vo[\'id\']}">点击查看</a></td>',
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
	];
}
